<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:replace="main_layout::html_header(~{::link}, _)">
	<link rel="stylesheet" th:href="@{/lib/DataTables/1.10.15/datatables.min.css}" />
	<link rel="stylesheet" th:href="@{/lib/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.min.css}" />
</head>
 
<body class="hold-transition skin-blue fixed">
<div class="wrapper">

<header class="main-header" th:replace="main_layout::header">
</header>

<aside class="main-sidebar">
	<section class="sidebar" th:replace="main_layout::menu">
	</section>
</aside>

<div class="content-wrapper">
<section class="content-header">
	<h1><a th:href="@{/}">首页</a><small><a th:href="@{/zlqd}">资料清单设置</a></small></h1>
</section>
	
<section class="content">
<div class="box box-info">
				
<div class="box-body">
  <table class="table table-bordered table-hover" id="zlqd_table">
    <thead>
    <tr>
      <th>编号</th>
      <th>资料清单类别</th>
      <th>合同清单</th>
      <th>资料清单</th>
      <th>操作</th>
    </tr>
    <thead>
  </table>
</div>

</div>
</section>
</div>
  
<footer class="main-footer" th:replace="main_layout::footer">
</footer>


<aside class="control-sidebar control-sidebar-light">
    
</aside>

<div class="control-sidebar-bg" ></div>

</div>

<!-- 资料清单对话框 S -->
<div class="modal fade" id="zlqd_modal" role="dialog">
<div class="modal-dialog modal-lg">
 <div class="modal-content">
 
<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	<h4 class="modal-title">资料清单设置</h4>
</div>

<div class="modal-body">
<div class="row" style="padding: 0px 20px">

<form action="#" class="form-horizontal" id="zlqd_form">
	<input type="hidden" name="id" />
	<div class="form-group">
		<label class="col-sm-2 control-label">合同清单</label>
		<div class="col-sm-10">
			<textarea class="form-control" name="ht" rows="4"></textarea>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">资料清单</label>
		<div class="col-sm-10">
			<textarea class="form-control" name="zl" rows="4"></textarea>
		</div>
	</div>
</form>
   
</div>
</div>

<div class="modal-footer">
	<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
	<button type="button" class="btn btn-primary" onclick="$('#zlqd_form').submit();">保存</button>
</div>

</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!--资料清单对话框 E -->

<script th:src="@{/lib/DataTables/1.10.15/datatables.min.js}"></script>
<script th:src="@{/lib/DataTables/datatables.config.js}"></script>
<script th:src="@{/lib/jquery-validation/1.16.0/jquery.validate.min.js}"></script>
<script th:src="@{/lib/jquery-validation/1.16.0/messages_zh.js}"></script>
<script th:src="@{/lib/moment/2.18.1/moment.min.js}"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script th:src="@{/lib/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.min.js}"></script>
<script th:src="@{/lib/bootstrap-datepicker/1.6.4/locales/bootstrap-datepicker.zh-CN.min.js}"></script>
<script>
var zlqd_table, validate;
function edit_zlqd(id) {
	$("#zlqd_form").initForm(validate);	
	$.post("[[@{/system/zlqd/edit}]]", {id: id}, function(ret){
		if(ret) {
			$("#zlqd_form").setValues(ret);
			$("#zlqd_modal").modal({backdrop:'static', keyboard: false});
		}
	}, "json");
}
$(function() {
	validate = $("#zlqd_form").validate({
		submitHandler:function(form){
			$.post("[[@{/system/zlqd/save}]]", $("#zlqd_form").serializeArray(), function(ret){
				if(ret.success) {
					$("#zlqd_modal").modal('hide');
					zlqd_table.ajax.reload();
				} else {
					$.dialog.alert(ret.message);
				}
			}, "json");
		}
	});
	zlqd_table = $('#zlqd_table').DataTable({
		serverSide: false,
		select: false,
        ajax: {
            url: "[[@{/system/zlqd/list}]]",
            type: 'POST',
            dataSrc: ''
        },
        columnDefs: [
        	{targets: 1, width: '300px'},
        	{targets: -1, orderable: false,  width: "100px",  className: "align_center", render: function(data, type, full, meta ) {
            	return	"<a href = 'javascript:;' onclick='edit_zlqd(\"" + full[0] + "\")'>修改</a>";
            }}
        ]
    });
});
</script>
</body>
</html>
